package homework.day06;
public class CreditAccount extends Account{
    private double overdraw;//透支额度
    private  double Credit;//信用度

    public CreditAccount(int id, String name, String password, int telno, double balance, double overdraw, double credit, double mouney) {
        super(id, name, password, telno, balance);
        this.overdraw = overdraw;
        Credit = credit;
    }

    public double getOverdraw() {
        return overdraw;
    }

    public void setOverdraw(double overdraw) {
        this.overdraw = overdraw;
    }

    public double getCredit() {
        return Credit;
    }

    public void setCredit(double credit) {
        Credit = credit;
    }

    public  double withdraw( double mouney) {
        if ( getCredit() > 70 &&getBalance()>-5000) {
        double m=getBalance();
           m -= mouney;
           setBalance(m);

            System.out.println("取款" + mouney + "元,当前存款为" +getBalance() + "元");
            return getBalance();
        } else {
            System.out.println("你的信用太低，无法透支");


        }

        return getBalance();
    }


}
